#include <stdio.h>
#include <stdlib.h>
int main()
{
	int i,m,a[10];
	//start    
	void func_xx(int b[],int n);
	//end
	while(scanf("%d",&a[0])!=-1)
	{
		for(i=1; i<10; i++)
			scanf("%d",&a[i]);
		func_xx(a,10);
		for(i=0; i<10; i++)
			printf("%d ",a[i]);
		printf("\n");
	}
	return 0;
}
void func_xx(int b[],int n)
{
//start
	int maxn=-1e5, minn=1e5, flag1=-1, flag2=-1;
	for(int i=0; i<n; i++)
	{
		if(maxn < b[i])
		{
			maxn = b[i];
			flag1 = i;
		}
		if(minn > b[i])
		{
			minn = b[i];
			flag2 = i;
		}
	}
	int tmp = b[flag1];
	b[flag1] = b[flag2];
	b[flag2] = tmp;
//end
}
